<?php
namespace app\promotion\validate;

use think\Validate;

/**
 * 验证
 */
class PromotionTuan extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'promotion_id'      => 'require|integer',
        'tuan_id'           => 'require|integer',
        'course_id'         => 'require|integer',
    ];

    protected $field = [
        'promotion_id'      => '活动',
        'tuan_id'           => '团',
        'course_id'         => '课程',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'phone.mobile'      => '手机号码格式不正确',

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create'        => ['promotion_id'],
        'join'          => ['tuan_id'],
        'detail'        => ['tuan_id'],
        'course'        => ['promotion_id'],
    ];

}
